import {
  Controller,
  Get,
  Inject,
  // Inject,
  // UseInterceptors,
  Version,
} from '@nestjs/common';
import { InjectModel } from '@nestjs/mongoose';
// import { User } from './user/user.schema';
import { Model } from 'mongoose';
// import { InjectRedis } from './common/cache/redis/redis.decorators';
// import Redis from 'ioredis';
// import { Cache, CACHE_MANAGER, CacheInterceptor } from '@nestjs/cache-manager';
// import { PrismaService } from './database/prisma/prisma.service';
import { Repository } from 'typeorm';
import { User } from './user/user.entity';
import { InjectRepository } from '@nestjs/typeorm';
import { PrismaClient } from '@prisma/client';
import { UserRepository } from './user/user.repository';

@Controller()
// @UseInterceptors(CacheInterceptor)
export class AppController {
  constructor(
    // @InjectRepository(User) private repository: Repository<User>,
    // @Inject('prisma1') private prismaClient: PrismaClient,
    private userRepository: UserRepository,
    // @Inject('prisma2') private prismaClient2: PrismaClient,
  ) {
    // this.userRepository = this.repository;
  }

  @Get()
  @Version('1')
  async getHello() {
    // const res = await this.prismaClient2.user.findMany({});
    const res = await this.userRepository.findAll();
    return res;
  }
  @Get()
  @Version('2')
  async getHello2() {
    // const res = await this.prismaClient.user.findMany();
    // return res;
  }
}
